<template>
  <div class="app-container" v-loading="pageLoading">
    <el-button type="primary" class="fr" @click="createItem" v-permission="'machineType.add'">创建</el-button>
    <div class="filter-container">
      <el-input style="width: 200px;" placeholder="输入设备类型信息查询" clearable prefix-icon="el-icon-search"
        class="filter-item" @keyup.enter.native="research" @clear="research" v-model="query.queryString"></el-input>
      <el-button class="filter-item" type="success" plain @click="research">查询</el-button>
      <el-button class="filter-item" type="info" plain @click="exportData" :loading="exportLoading">导出
      </el-button>
    </div>
    <z-table :list="list" :tableProps="tableProps" :columns="columns" @editItem="editItem" @deleteItem="deleteItem">
      <template v-slot:operation="v">
        <a href="#" class="text-blue" @click.prevent="editItem(v.row,v.$index)" v-permission="'machineType.edit'">编辑</a>
        <span>&nbsp;</span>
        <span>&nbsp;</span>
        <a href="#" class="text-red" @click.prevent="deleteItem(v.row,v.$index)"
          v-permission="'machineType.delete'">删除</a>
      </template>
    </z-table>
    <z-pagination :pagination="pagination" :total="total" :page.sync="query.page" :limit.sync="query.size"
      @change="getList"></z-pagination>
    <z-form-dialog :name="name" :data="data" :formProps="formProps" :fields="fields" @submit="submit"
      :submitLoading="submitLoading" :visible.sync="editFormVisible"></z-form-dialog>
  </div>
</template>

<script>
import commonMixin from '@/views/_common/mixin'
export default {
  mixins: [commonMixin],
  name: 'machineType',
  data: function () {
    return {
      api: this.$api.machineType,
      apiEdit: this.$api.machineType + 'add',
      name: '设备类型',
      columns: [
        { title: '设备类型编号', key: 'machine_type_code' },
        { title: '设备类型名称', key: 'machine_type_name' },
        { title: '设备类型描述', key: 'machine_type_desc' },
        { title: '备注', key: 'remarks' },
        { title: '修改人', key: 'create_user' },
        { title: '修改时间', key: 'create_time' },
      ],
      fields: [
        { title: '设备类型编号', key: 'machine_type_code', required: true },
        { title: '设备类型名称', key: 'machine_type_name', required: true },
        { title: '设备类型描述', key: 'machine_type_desc' },
        { title: '备注', key: 'remarks' },
      ],
      query: {
        queryString: '',
        page: 1,
        size: 10,
      },
      initData: {},
      tableProps: {
        border: true,
        opsColWith: 140,
      },
    }
  },
  methods: {},
  created: function () {
    this.getList()
  },
}
</script>
<style scoped>
</style>
